package com.dyna.lua;

public interface LuaScript {

    /** redis扣减库存脚本 */
    String DECR_LUA_SCRIPT = "local num = tonumber(ARGV[1])\n" +
            "local current = tonumber(redis.call('GET', KEYS[1]) or 0)\n" +
            "if current >= num then\n" +
            "    return redis.call('DECRBY', KEYS[1], num)\n" +
            "else\n" +
            "    return -1\n" +
            "end";

}
